 import { baseUrl, del_goods_img, ftp_goodsFile, get_goodsInfo, update_goodsInfo } from "../../utils/api.js"
import WxValidate from '../../utils/WxValidate'

const util = require('../../utils/util')
const {
  getTimeSeconds
} = util

// pages/goodsEdit/goodsEdit.js
const app = getApp()
var haveTap = 1// 1: 可以点击 0：不可点击
Page({

  /**
   * 页面的初始数据
   */
  data: {
    submint_statsus: true,
    goodsId: '',
    TaskShow: 0,
    FormList: [{
      title: '商品名',
      name: 'title',
      placeholder: '请填写商品名',
      type: 1,
      input_type: 'text'
    },
    {
      title: '价格',
      name: 'price',
      placeholder: '请填写商品价格(100000以内)',
      type: 1,
      input_type: 'digit'
    },
    {
      title: '原价(展示)',
      name: 'oldPrice',
      placeholder: '请填写商品展示价格(100000以内)',
      type: 1,
      input_type: 'digit'
    },
    {
      title: '商品总数量',
      name: 'totalMount',
      placeholder: '请填写商品总数量',
      type: 1,
      input_type: 'number'
    },
    {
      title: '佣金比例(%)',
      name: 'commissionRate',
      placeholder: '请填写佣金比例',
      type: 1,
      input_type: 'number'
    },
    {
      title: '排序值',
      name: 'sort',
      placeholder: '请填写排序值',
      type: 1,
      input_type: 'number'
    },
    {
      title: '上下架',
      name: 'status',
      switchs: '1',
      type: 1,
      input_type: 'text'
    },
    {
      title: '积分抵扣',
      name: 'integral_price',
      placeholder: '请填写商品可抵扣的积分值',
      type: 1,
      input_type: 'digit'
    },
    {
      title: '商品描述',
      name: 'describee',
      placeholder: '请填写商品描述',
      type: 1,
      input_type: 'text'
    },
    {
      title: '分类',
      name: 'cat_id',
      picker: '请选择分类',
      type: 1,
      input_type: 'text'
    },
      {
        title: '限购',
        name: 'limied_status',
        switchs_limited: '1',
        type: 1,
        input_type: 'text'
      },
      {
        title: '限购类型',
        name: 'limited',
        picker_limited: '请选择',
        type: 1,
        input_type: 'text'
      },
      {
        title: '限购数量',
        name: 'limited_num',
        placeholder: '请填写限购数量',
        type: 1,
        input_type: 'number'
      },
      // {
      //   title: '运费',
      //   name: 'freight_free',
      //   placeholder: '请填写商品运费',
      //   type: 1,
      //   input_type: 'number'
      // },
    ],
    cat_id: 0,
    multiArray: [],//二维数组，长度是多少是几列
    multiArrayOther: [],
    multiIndex: [0, 0],
    GoodsLogo: {
      type: 0,
      src: ''
    },
    Video: {
      type: 0,
      src: ''
    },
    Pictuer: {
      type: 0,
      srcList: []
    },
    DetailPictuer: {
      type: 0,
      srcList: []
    },
    isChecked1: true,
    isCheckedLimited:false,
    arrayLimited: ['请选择限购类型','每日每人限购数量', '每月每人限购数量', '每年每人限购数量'],
    indexLimited: 0,
    limited_num:0
  },
  bindPickerChangeLimited: function (e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      indexLimited: e.detail.value
    })
  },
  //多列选择器：
  bindMultiPickerChange: function (e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    var that = this;
    var index = e.detail.value
    that.setData({
      multiIndex: e.detail.value,
      cat_id: that.data.multiArray[1][index[1]].id
    })

  },
  bindMultiPickerColumnChange: function (e) {
    var that = this;
    var data = {
      multiArray: that.data.multiArray,
      multiArrayOther: that.data.multiArrayOther,
      multiIndex: that.data.multiIndex
    };
    data.multiIndex[e.detail.column] = e.detail.value;
    console.log(e.detail.column);
    // console.log('修改的列为', e.detail.column, '，值为', e.detail.value);
    switch (e.detail.column) {//第1列
      case 0:
        data.multiArray[1] = data.multiArrayOther[data.multiIndex[0]];
        data.multiIndex[1] = 0;
        that.setData(data)
        break;
    };

  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //获取商品信息
    if (options.id) {
      this.getGoodsInfo(options.id)

      this.setData({
        goodsId: options.id
      })
    } else {
      this.getCatInfo()
    }
    haveTap = 1;
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    // console.log('onshow')
  },
  getCatInfo: function () {
    var that = this;
    app.HttpPostSend(
      '/shop_api/cateInfo', {},
      function (res) {
        if (res.msg != "success") {
          app.showTipMsg(res.msg);
        } else {
          var re_data = res.data;
          that.setData({
            multiArray: re_data.multiArray,
            multiArrayOther: re_data.multiArrayOther,
            cat_id: re_data.multiArray[1][that.data.multiIndex[1]].id
          });
        }
      })
  },
  // 获取商品信息
  getCarteGoods: function (id) {
    const that = this
    let p = new Promise((resolve, reject) => {
      try {
        app.HttpPostSend(
          get_goodsInfo, {
            id: id
          },
          function (res) {
            if (res.msg != "success") {
              app.showTipMsg(res.msg);
            } else {
              let userInfo = { ...res.data }
              that.setData({
                userInfo
              })
              if (res.data.change_cat > 0) {
                wx.showModal({
                  title: '提示',
                  content: '该商品的分类已下架，请重新编辑',
                  success(res) {
                    if (res.confirm) {
                      console.log('用户点击确定')
                    } else if (res.cancel) {
                      console.log('用户点击取消')
                    }
                  }
                })
              }
              resolve(userInfo)
            }
          })
      } catch (error) {
        console.log(error)
        reject(error)
      }
    })
    return p
  },

  // 获取商品信息
  getGoodsInfo: function (id) {
    const that = this
    try {
      this.getCarteGoods(id).then(res => {
        let userInfo = res

        let checkNullEmptyUndefined = (aim) => {
          // console.log(typeof (aim) != 'undefined')
          // console.log(aim != 'undefined')
          if (aim != '' && aim != null && typeof (aim) != 'undefined' && aim != 'undefined') {
            return true
          } else {
            return false
          }
        }
        let changed = {}
        // 商品标题
        if (checkNullEmptyUndefined(userInfo.goods.title)) {
          changed['FormList[0].content'] = userInfo.goods.title
        }
        // 价格
        if (checkNullEmptyUndefined(userInfo.goods.price)) {
          changed['FormList[1].content'] = userInfo.goods.price
        }
        // 原价
        if (checkNullEmptyUndefined(userInfo.goods.old_price)) {
          changed['FormList[2].content'] = userInfo.goods.old_price
        }
        // 商品总数
        if (checkNullEmptyUndefined(userInfo.goods.total_mount)) {
          changed['FormList[3].content'] = userInfo.goods.total_mount
        }
        // 佣金比例

        changed['FormList[4].content'] = userInfo.goods.commission_rate
        // 排序   默认为0
        changed['FormList[5].content'] = JSON.stringify(userInfo.goods.sort)

        // 上下架   默认为上架1
        if (userInfo.goods.status == 0) {
          that.setData({
            isChecked1: false
          })
        }
        if (userInfo.goods.limited_status >0) {
          console.log(userInfo.goods.limited_num);
          that.setData({
            isCheckedLimited: true,
            indexLimited: userInfo.goods.limited_type,
            limited_num: userInfo.goods.limited_num
          })
        }

        if (checkNullEmptyUndefined(userInfo.goods.integral_price)) {
          changed['FormList[7].content'] = userInfo.goods.integral_price
        }
        // if (checkNullEmptyUndefined(userInfo.goods.freight_free)) {
        //   changed['FormList[13].content'] = userInfo.goods.freight_free
        // }
        //describee
        if (checkNullEmptyUndefined(userInfo.goods.describee)) {
          changed['FormList[8].content'] = userInfo.goods.describee
        }
        changed['multiArray'] = userInfo.multiArray
        changed['multiArrayOther'] = userInfo.multiArrayOther
        changed['multiIndex'] = userInfo.multiIndex
        changed['cat_id'] = userInfo.multiArray[1][userInfo.multiIndex[1]].id
        // 封面图
        if (userInfo.goods_face.length > 0 && userInfo.goods_face != null) {
          changed['GoodsLogo.type'] = 1
          changed['GoodsLogo.src'] = userInfo.goods_face[0].img_url
          changed['GoodsLogo.id'] = userInfo.goods_face[0].id
        }
        // 轮播中视频
        if (userInfo.goods_video.length > 0 && userInfo.goods_video != null) {
          changed['Video.type'] = 1
          changed['Video.src'] = userInfo.goods_video[0].img_url
          changed['Video.id'] = userInfo.goods_video[0].id
        }
        // 轮播图
        if (userInfo.goods_turn.length > 0 && userInfo.goods_turn != null) {
          changed['Pictuer.type'] = 1
          changed['Pictuer.srcList'] = userInfo.goods_turn
        }
        // 详情图
        if (userInfo.goods_details.length > 0 && userInfo.goods_details != null) {
          changed['DetailPictuer.type'] = 1
          changed['DetailPictuer.srcList'] = userInfo.goods_details
        }
        this.setData({
          ...changed,
          userInfo
        })
      })
    } catch (error) {
      console.log(error)
    }
  },
  limited_numInputChange: function (e) {
    
    this.setData({
      limited_num: e.detail.value
    })
  },

  // 商品标题输入
  titleInputChange: function (e) {
    // console.log(e)
    let changed = new Object()
    changed['FormList[0].content'] = e.detail.value
    this.setData(changed)
  },

  // 价格输入
  priceInputChange: function (e) {
    // console.log(e)
    let changed = new Object()
    changed['FormList[1].content'] = e.detail.value
    this.setData(changed)
  },

  // 原价输入
  oldPriceInputChange: function (e) {
    // console.log(e)
    let changed = new Object()
    changed['FormList[2].content'] = e.detail.value
    this.setData(changed)
  },

  // 商品总数输入
  totalMountInputChange: function (e) {
    // console.log(e)
    let changed = new Object()
    changed['FormList[3].content'] = e.detail.value
    this.setData(changed)
  },

  // 佣金比例输入
  commissionRateInputChange: function (e) {
    // console.log(e)
    let changed = new Object()
    changed['FormList[4].content'] = e.detail.value
    this.setData(changed)
  },

  // 排序默认为0输入
  sortInputChange: function (e) {
    // console.log(e)
    let changed = new Object()
    changed['FormList[5].content'] = e.detail.value
    this.setData(changed)
  },

  integral_priceInputChange: function (e) {
    console.log(e)
    let changed = new Object()
    changed['FormList[7].content'] = e.detail.value
    this.setData(changed)
  },

  freight_freeInputChange: function (e) {
    console.log(e)
    let changed = new Object()
    changed['FormList[13].content'] = e.detail.value
    this.setData(changed)
  },

  changeSwitchLimited: function (e) {
    
    this.setData({
      isCheckedLimited: !this.data.isCheckedLimited
    })
    

  },


  //点击设置上下架
  changeSwitch1: function (e) {
    let changed = new Object()
    this.setData(changed)
    this.setData({
      isChecked1: !this.data.isChecked1
    })
    var url2 = '/Shop_api/setStatus';
    var params2 = {
      goodsId: this.data.goodsId
    };
    var that = this;
    app.HttpPostSend(url2, params2, function (res) {
      if (res.msg != "success") {
        app.showTipMsg(res.msg);
      } else {

      }
    });

  },

  // 选择图片
  selectFile: function (e) {
    const that = this
    wx.chooseImage({
      count: 1,
      sizeType: ['original', 'compressed'],
      sourceType: ['album', 'camera'],
      success(res) {
        // tempFilePath可以作为img标签的src属性显示图片
        const tempFilePaths = res.tempFilePaths[0]
        that.ftpFile({
          type: e.currentTarget.dataset.type,
          src: tempFilePaths
        })
      },
      complete(res) {
        // console.log(res)
      }
    })
  },

  // 选择视频
  selectVideo: function (e) {
    const that = this
    wx.chooseVideo({
      sourceType: ['album', 'camera'],
      maxDuration: 60,
      camera: 'back',
      success(res) {
        // console.log(res.tempFilePath)
        const tempFilePaths = res.tempFilePath
        that.ftpFile({
          type: e.currentTarget.dataset.type,
          src: tempFilePaths,
          // uid: that.data.userInfo.id,
        })
      }
    })
  },

  // 照片选择图片
  selectFile1: function (e) {
    const that = this
    if (e.currentTarget.dataset.type == 2) {
      var imglen = that.data.Pictuer.srcList.length;
      var tishi = "最多六张图片";
      var count = 6;
    } else if (e.currentTarget.dataset.type == 3) {
      imglen = that.data.DetailPictuer.srcList.length;
      tishi = "最多九张图片";
      count = 9;
    }
    wx.chooseImage({
      count: count, // 默认9  
      sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有 
      sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有  
      success: function (res) {
        if (res.tempFilePaths.length > 0) {
          //图如果满了9张，不显示加图
          if (imglen + res.tempFilePaths.length < 9) {
            //把每次选择的图push进数组
            for (let i = 0; i < res.tempFilePaths.length; i++) {
              that.ftpFile({
                type: e.currentTarget.dataset.type,
                src: res.tempFilePaths[i],
                // uid: that.data.userInfo.id,
              })
            }
          } else {
            wx.showModal({
              title: '提示',
              content: tishi
            })
            return;
          }
        }
      }
    })

  },

  // 文件提交
  ftpFile: function (params) {
    const that = this
    wx.showLoading({
      title: '上传中',
    })
    wx.uploadFile({
      url: baseUrl + ftp_goodsFile, // 仅为示例，非真实的接口地址
      filePath: params.src,
      name: 'file',
      formData: {},
      success(res) {
        wx.hideLoading();
        let json_res = JSON.parse(res.data)
        if (json_res.code != 1) {
          app.showTipMsg('上传出错');
        } else {
          let changed = {}
          switch (Number(params.type)) {
            case 1:
              changed['GoodsLogo.type'] = 1
              changed['GoodsLogo.src'] = json_res.url
              that.setData(changed)
              break;

            case 2:
              let { Pictuer } = that.data

              Pictuer.srcList.push({
                img_url: json_res.url
              });
              changed['Pictuer.type'] = 1
              changed['Pictuer.srcList'] = Pictuer.srcList
              that.setData(changed)
              break;

            case 3:
              let { DetailPictuer } = that.data
              DetailPictuer.srcList.push({
                img_url: json_res.url
              });
              changed['DetailPictuer.type'] = 1
              changed['DetailPictuer.srcList'] = DetailPictuer.srcList
              that.setData(changed)
              break;

            case 4:
              changed['Video.type'] = 1
              changed['Video.src'] = json_res.url
              that.setData(changed)
              break;

            default:
              break;
          }
        }
      },
      fail(err) {
        console.log(err)
      }
    })
  },

  // 删除文件
  deleteFile: function (e) {
    const that = this
    var type = e.currentTarget.dataset.type
    const id = e.currentTarget.dataset.id
    if (id) {
      let params = {
        id: id
      }
      app.HttpGetSend(
        del_goods_img, {
          ...params
        },
        function (res) {
          // console.log(res)
          if (res.msg != "success") {
            app.showTipMsg(res.msg);
          } else {
            let changed = {}
            switch (Number(type)) {
              case 1:
                changed['GoodsLogo.type'] = 0
                changed['GoodsLogo.src'] = ''
                that.setData(changed)
                break;

              case 4:
                changed['Video.type'] = 0
                changed['Video.src'] = ''
                that.setData(changed)
                break;

              default:
                break;
            }
          }
        })
    } else {
      let changed = {}
      switch (Number(type)) {
        case 1:
          changed['GoodsLogo.type'] = 0
          changed['GoodsLogo.src'] = ''
          that.setData(changed)
          break;

        case 4:
          changed['Video.type'] = 0
          changed['Video.src'] = ''
          that.setData(changed)
          break;

        default:
          break;
      }
    }
  },

  // 删除商品轮播图片
  delUserImg: function (e) {
    const that = this
    const id = e.currentTarget.dataset.id
    const idx = e.currentTarget.dataset.idx
    if (id) {
      app.HttpGetSend(
        del_goods_img, {
          id: id
        },
        function (res) {
          // console.log(res)
          if (res.msg != "success") {
            app.showTipMsg(res.msg);
          } else {
            let changed = new Object()
            let { Pictuer } = that.data
            if (Pictuer.srcList.length > 1) {
              Pictuer.srcList.splice(idx, 1);
              changed['Pictuer.srcList'] = Pictuer.srcList
            } else {
              changed['Pictuer.type'] = 0
              changed['Pictuer.srcList'] = []
            }
            that.setData(changed)
          }
        })
    } else {
      let changed = new Object()
      let { Pictuer } = that.data
      if (Pictuer.srcList.length > 1) {
        Pictuer.srcList.splice(idx, 1);
        changed['Pictuer.srcList'] = Pictuer.srcList
      } else {
        changed['Pictuer.type'] = 0
        changed['Pictuer.srcList'] = []
      }
      that.setData(changed)
    }
  },

  // 删除商品详情图片
  delDetailImg: function (e) {
    const that = this
    const id = e.currentTarget.dataset.id
    const idx = e.currentTarget.dataset.idx
    if (id) {

      app.HttpGetSend(
        del_goods_img, {
          id: id
        },
        function (res) {
          if (res.msg != "success") {
            app.showTipMsg(res.msg);
          } else {
            let changed = new Object()
            let { DetailPictuer } = that.data
            if (DetailPictuer.srcList.length > 1) {
              DetailPictuer.srcList.splice(idx, 1);
              changed['DetailPictuer.srcList'] = DetailPictuer.srcList
            } else {
              changed['DetailPictuer.type'] = 0
              changed['DetailPictuer.srcList'] = []
            }
            that.setData(changed)
          }
        })
    } else {
      let changed = new Object()
      let { DetailPictuer } = that.data
      if (DetailPictuer.srcList.length > 1) {
        DetailPictuer.srcList.splice(idx, 1);
        changed['DetailPictuer.srcList'] = DetailPictuer.srcList
      } else {
        changed['DetailPictuer.type'] = 0
        changed['DetailPictuer.srcList'] = []
      }
      that.setData(changed)
    }
  },

  deleteGoods: function (e) {
    const that = this
    if (haveTap == 0) {
      console.log('屏蔽重复点击')
    } else {
      haveTap = 0
      wx.showModal({
        title: '提示',
        content: '确定要删除该商品吗',
        success(res) {
          if (res.confirm) {
            var url2 = '/Shop_api/goodsDel';
            var params2 = {
              goodsId: that.data.goodsId,
              mgId:app.globalData.userInfo.id
            };
            app.HttpPostSend(url2, params2, function (res) {
              if (res.msg != "success") {
                app.showTipMsg(res.msg);
              } else {
                app.showTipMsg('删除成功');
                wx.reLaunch({
                  url: '/pages/manageGoods/manageGoods'
                })
              }
            })
          } else if (res.cancel) {
            console.log('用户点击取消')
            haveTap = 1
          }
        }
      })
    }
  },

  // 表单提交
  formSubmit: function (e) {
    // console.log(e)
    const that = this
    // 验证字段的规则
    const rules = {
      title: {
        required: true
      },
      price: {
        required: true
      },
      oldPrice: {
        required: true
      },
      totalMount: {
        required: true
      },
      commissionRate: {
        required: true,
        min: 1,
        max: 30
      },
      sort: {
        required: true
      },
      integral_price: {
        required: true
      },
      // freight_free:{
      //   required: true
      // }
    }

    // 验证字段的提示信息，若不传则调用默认的信息
    const messages = {
      title: {
        required: '请填写商品名',
      },
      price: {
        required: '请填写价格',
      },
      oldPrice: {
        required: '请填写商品展示价格',
      },
      totalMount: {
        required: '请填写商品总数量',
      },
      commissionRate: {
        required: '请填写佣金比例',
        min: '佣金比例至少1%',
        max: '佣金比例最多30%'
      },
      sort: {
        required: '请填写排序值',
      },
      integral_price: {
        required: '请填写积分抵扣值',
      },
      // freight_free: {
      //   required: '请填写商品运费',
      // },
    }

    // 创建实例对象
    let formWxValidate = new WxValidate(rules, messages)

    //报错 
    let errModal = (error) => {
      wx.showModal({
        content: error.msg,
        showCancel: false,
      })
    }

    let params = {
      ...e.detail.value
    }
    try {
      if (!formWxValidate.checkForm(params)) {
        const error = formWxValidate.errorList[0]
        // console.log(error)
        errModal(error)
        return false
      } else {

        if (that.data.cat_id == 0) {
          errModal({
            msg: '请选择分类'
          })
          return false;
        }
        if (that.data.isCheckedLimited == true) {
          if(that.data.indexLimited==0){
            errModal({
              msg: '请选择限购类型'
            })
            return false;
          }
          if (params.limited_num>0) {
            
          }else{
            errModal({
              msg: '请填写限购数量'
            })
            return false;
          }
        }


        let GoodsLogo = that.data.GoodsLogo
        if (GoodsLogo.type == 0) {
          errModal({
            msg: '请上传封面图'
          })
        } else if (that.data.Pictuer.type == 0) {
          errModal({
            msg: '请上传轮播图'
          })
        } else if (that.data.DetailPictuer.type == 0) {
          errModal({
            msg: '请上传详情图'
          })
        } 
        // else if (parseFloat(params.price) <= parseFloat(params.integral_price)){
          
        //   errModal({
        //     msg: '积分数值不能超过商品价格'
        //   })
        // } 
        else {
          var submint_statsus = that.data.submint_statsus;
          if (submint_statsus == true) {
            params.face_img = that.data.GoodsLogo.src
            params.imgs = '';
            for (var i = 0; i < that.data.Pictuer.srcList.length; i++) {
              params.imgs += that.data.Pictuer.srcList[i].img_url + ',';
            }
            params.details_img = '';
            for (var i = 0; i < that.data.DetailPictuer.srcList.length; i++) {
              params.details_img += that.data.DetailPictuer.srcList[i].img_url + ',';
            }
            params.video = that.data.Video.src
            if (that.data.goodsId) {
              params.id = that.data.goodsId
            }
            params.mgId = app.globalData.userInfo.id
            params.cat_id = that.data.cat_id
            params.limited_status = that.data.isCheckedLimited
            params.indexLimited = that.data.indexLimited
            params.limited_num = that.data.limited_num
            that.setData({
              submint_statsus: false
            });
            var paramss = {
              timestamp: new Date().getTime(),
              ...params
            }
            paramss.sign = app.getSign(paramss)
            app.HttpPostSend(
              '/shop_api/addGoods1_v4', paramss ,
              function (res) {
                that.setData({
                  submint_statsus: true
                });
                // console.log(res)
                if (res.msg != "success") {
                  app.showTipMsg(res.msg);
                } else {
                  wx.navigateBack({
                    url: '/pages/manageGoods/manageGoods',
                  })
                }
              })
          }

        }
      }
    } catch (error) {
      console.log(error)
    }
  },

  // 页面onhide提交
  formSubmitOnhide: function () {
    // console.log(e)
    const that = this
    const FormList = this.data.FormList
    let checkNullEmptyUndefined = (aim) => {
      // console.log(typeof (aim) != 'undefined')
      // console.log(aim != 'undefined')
      if (aim != '' && aim != null && typeof (aim) != 'undefined' && aim != 'undefined') {
        return true
      } else {
        return false
      }
    }

    let params = new Object()
    for (let i = 0; i < FormList.length; i++) {
      params[FormList[i].name] = ''
      if (checkNullEmptyUndefined(FormList[i].content)) {
        params[FormList[i].name] = FormList[i].content
      }
    }
    try {
      app.HttpPostSend(
        update_goodsInfo, {
          mgId: app.globalData.userInfo.id,
          ...params
        },
        function (res) {
          // console.log(res)
          if (res.msg != "success") {
            app.showTipMsg(res.msg);
          } else {

          }
        })

    } catch (error) {
      console.log(error)
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    // this.formSubmitOnhide()
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  // onShareAppMessage: function () {

  // }
})